import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import '../pages/Login.dart';
import 'dart:async';

class launch extends StatefulWidget {
  @override
  _launchState createState() => new _launchState();
}

class _launchState extends State<launch> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    startTime();
//   navigator();
  }

  @override
  Widget build(BuildContext context) {
    return new Container(
        decoration: BoxDecoration(
      image: DecorationImage(
        image: AssetImage("images/splash.jpg"),
        fit: BoxFit.cover,
      ),
    ));
  }

  void navigator() {
    Navigator.pushAndRemoveUntil(context,
        new MaterialPageRoute(builder: (BuildContext context) {
      return Login();
    }), (route) => route == Null);
  }

  startTime() async {
    //设置启动图生效时间
    var _duration = new Duration(seconds: 3);
    return new Timer(_duration, navigator);
  }
}
